#include<bits/stdc++.h>
using namespace std;
int n;
vector<int>r;
int ans;
void dfs(vector<int>a,int w){
    if(w==a.size()){
        int m=a.size()-1;
        if(a[0]<a[m])ans--;
        return;
    }

    vector<int>b;
    b.empty();
    int cnt=1;
    int x=a[w-1];

    for(int i=1;i<a.size();i++){
        if(a[i]==x)cnt++;
        else if(a[i]>x){
            if(cnt>0){
                b.push_back(a[i]);
                cnt--;
                ans--;
            }
            else{
                for(int j=i;j<a.size();j++)b.push_back(a[j]);
                w=i+b.size()-a.size();
                dfs(b,w);
                break;
            }
        }
    }
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    r.resize(n);
    for(int i=0;i<n;i++){
        cin>>r[i];
    }
    ans=n;
    sort(r.begin(),r.end());
    dfs(r,1);
    cout<<ans<<endl;
    return 0;
}


